package com.example.mapper;

import com.example.bean.Event;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface EventMapper {

    //赛事查询
    @Select("select * from event where eventsName like #{eventsName} order by startTime desc")
    List<Event> selectEvent(@Param("eventsName") String eventsName);

    //赛事创建（预告）
    @Insert("insert into event(eventsName, venues, equipments, refereeInfo, startTime, endTime) values(#{eventsName}, #{venues}, #{equipments}, #{refereeInfo}, #{startTime}, #{endTime})")
    void addEvent(Event event);

    //赛事取消
    @Delete("delete from event where eventsId = #{eventsId}")
    void deleteEvent(@Param("eventsId") int eventsId);

    //显示最新的赛事
    @Select("select * from event order by startTime desc limit 10")
    List<Event> selectEventNear();

    //显示所有赛事
    @Select("select * from event order by startTime desc")
    List<Event> selectAll();

}

